<?php
/**
 * Created by PhpStorm.
 * User: zd
 * Date: 2018/8/10
 * Time: 17:23
 */

namespace app\api\model;


use think\Model;

class Banner extends BaseModel
{
    /**
     * 对象隐藏字段
     * @var array
     */
    protected $hidden = ['delete_time','update_time'];
    /**
     * 数据库关联
     * @return \think\model\relation\HasMany
     */
    public function  items(){
        return $this->hasMany('BannerItem','banner_id','id');
    }
    /**
     * 获取banner详细信息
     * @param $id
     * @return array|false|\PDOStatement|string|Model
     */
    public static function getBannerByID($id){
       $banner =  self::with(['items','items.img'])->find($id);
       return $banner;
    }

}